package com.cxl.demo.mapper;


import com.cxl.demo.vo.Image;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ImageMapper {

  @Insert("insert into image (formatName,uploadTime) values(#{formatName},#{uploadTime})")
  @Options(useGeneratedKeys = true,keyProperty = "imageId",keyColumn = "imageId")
  Integer AddImage(Image image);
  @Select("select count(1) from image")
  Integer getImageNum();
  @Select("select formatName from image where imageId=#{imageId}")
  String getImageById(Integer imageId);

  @Select("select * from image")
  List<Image> getImageList();
}
